<template>
	<view class="u-content">
		<u-parse :content="content"></u-parse>
	</view>
</template>

<script>
	import {
		getZoneNoticeDetail
	} from "@/api/school/index.js"
	import {
		genNoticeDetail
	} from "@/utils/genNoticeDetail.js"
	export default {
		data() {
			return {
				// 学校名称
				name: '',
				activityName: '',
				content: ""
			}
		},
		schoolId() {
			return this.$store.state.user.schoolId
		},
		methods: {
			zoneNoticeDetail(activityId, id) {
				getZoneNoticeDetail(activityId, id, this.schoolId).then(res => {
					console.log(this.activityName)

					this.content = genNoticeDetail(1, res, this.activityName, this.name)

					console.log(res)
				})


			},
			importNotice() {

				// let target = document.querySelector('#targetDom') //ID获取节点对象

				let target = this.$refs.targetDom //用ref获取节点对象
				// const query = uni.createSelectorQuery().in(this);
				// let target = query.select('#targetDom')
				this.$createPdf(target, '文件名')
				console.log("正在导出")
			}
		},
		onNavigationBarButtonTap(e) {

			// 点击导航栏自定义按钮
			this.importNotice()
		},
		onLoad(option) {
			this.name = option.name
			this.activityName = option.activityName
			this.zoneNoticeDetail(option.activityId, option.id)
		}
	}
</script>



<style>

</style>